/*
 * @Author       : 刘洋 liuy5335@163.com
 * @Date         : 2024-05-15 14:53:57
 * @LastEditors: ZJP 2712104231@qq.com
 * @LastEditTime: 2025-02-05 13:21:53
 * @FilePath: \zhlx-autoform-ui\install-render.js
 * @Description  : 介绍文件的作用
 * 
 * Copyright (c) 2024 by zhlx - liuy5335@163.com, All Rights Reserved. 
 */
import axios from 'axios'

import VFormRender from '@/components/form-render/index.vue'
import ContainerItems from '@/components/form-render/container-item/index'
import TableHighLevelColumn from '@/components/form-render/table-high-level-column'

import {registerIcon} from '@/utils/el-icons'
import 'virtual:svg-icons-register'
import '@/iconfont/iconfont.css'
import '@/assets/iconfont/index.css'
import '@/assets/scss/dialog.scss'
// 引入lib包所需公共样式
import '@/assets/scss/common.scss'

import { loadExtension } from '@/extension/extension-loader'
import FormItemWrapper from "@/components/form-designer/form-widget/field-widget/form-item-wrapper.vue";
import emitter from "@/utils/emitter";
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
import i18n from "@/utils/i18n";
import * as Utils from "@/utils/util";

import ZHLXCommonSelect from '@/components/ZHLX-Components/common/commonSelect/index2.vue' // 选人组件
import ZHLXFileList from '@/components/ZHLX-Components/ZHLX-uploadView/index.vue' // 附件列表组件
import ZHLXWpsWord from '@/components/ZHLX-Components/ZHLX-wpsWord/index.vue' // wpsword组件
import ZHLXWpsPdf from '@/components/ZHLX-Components/ZHLX-wpsPdf/index.vue' // wpsPdf组件
import ZHLXDocumentNumber from '@/components/ZHLX-Components/ZHLX-documentNumber/index.vue' // 文号组件
import ZHLXCarbonCopy from '@/components/ZHLX-Components/ZHLX-unitSelect/index.vue' // 抄送组件
import ZHLXDateRange from '@/components/ZHLX-Components/ZHLX-dateRange/index.vue' // 日期范围组件
import ZHLXBatchImport from '@/components/ZHLX-Components/ZHLX-batchImport/index.vue' // 批量导入组件

VFormRender.install = function (app) {
  loadExtension(app)

  app.use(ContainerItems)
  registerIcon(app)
  app.component(VFormRender.name, VFormRender)
  app.component(TableHighLevelColumn.name, TableHighLevelColumn)
}

const components = [
  VFormRender,
  TableHighLevelColumn
]

const install = (app) => {
  loadExtension(app)

  app.use(ContainerItems)
  registerIcon(app)
  components.forEach(component => {
    app.component(component.name, component)
  })

  window.axios = axios
}

if (typeof window !== 'undefined' && window.Vue) { /* script方式引入时赋值axios！！ */
  //window.axios = axios
}

const VFormSDK = {
  i18n,
  Utils,

  FormItemWrapper,
  emitter,
  fieldMixin,

  ZHLXCommonSelect,
  ZHLXFileList,
  ZHLXWpsWord,
  ZHLXWpsPdf,
  ZHLXDocumentNumber,
  ZHLXCarbonCopy,
  ZHLXDateRange,
  ZHLXBatchImport,
}

export default {
  install,
  VFormRender,
  VFormSDK
}
